<!DOCTYPE html>
<html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../resources/common.js"></script>
<body>
<input id="test" type="number" value="5" min="1" max="10"/>

<script type="text/javascript">
var test = document.getElementById("test");
var spinButton = getElementByPseudoId(internals.shadowRoot(test), "-webkit-inner-spin-button");
var rect = spinButton.getBoundingClientRect();
var spinButtonUpX = rect.left + rect.width / 2;
var spinButtonUpY = rect.top + rect.height / 4;
var expectedValue = 6;

var t = async_test('Test for a bug in setting composed flag for input events in a type=number input.');
test.addEventListener('input', t.step_func(e => {
  assert_true(e.composed);
  assert_equals(test.value, expectedValue.toString());
  if (expectedValue === 7)
    t.done();
  expectedValue++;
}));
test.focus();
t.step(() => {
  chrome.gpuBenchmarking.pointerActionSequence(
    [{ source: 'mouse',
      actions: [
        { name: 'pointerMove', x: spinButtonUpX, y: spinButtonUpY },
        { name: 'pointerDown', x: spinButtonUpX, y: spinButtonUpY },
        { name: 'pointerUp' }]}]
  );
});
eventSender.keyDown('ArrowUp');
</script>
</body>
</html>
